#include <QStringList>

#include "daysform.h"
#include "gudaywellwidget.h"
//
DaysForm::DaysForm( QWidget * parent, Qt::WFlags f) : QWidget(parent, f)
{
	setupUi(this);
	
	saturdayWidget	= new GudaywellWidget("saturday");
	sundayWidget 	= new GudaywellWidget("sunday");
	mondayWidget 	= new GudaywellWidget("monday");
	tuesdayWidget 	= new GudaywellWidget("tuesday");
	wednesdayWidget = new GudaywellWidget("wednesday");
	thursdayWidget 	= new GudaywellWidget("thursday");
	
	daysTBox->addItem(saturdayWidget,tr("Saturday"));
	daysTBox->addItem(sundayWidget,tr("Sunday"));
	daysTBox->addItem(mondayWidget,tr("Monday"));
	daysTBox->addItem(tuesdayWidget,tr("Tuesday"));
	daysTBox->addItem(wednesdayWidget,tr("Wednesday"));
	daysTBox->addItem(thursdayWidget,tr("Thursday"));
	
	currentWidget = saturdayWidget;
	
	connect(refreshButton,SIGNAL(clicked()),this,SLOT(refresh()));
}
//
void DaysForm::on_daysTBox_currentChanged(int index)
{
	switch(index){
		case 0: currentWidget = saturdayWidget;
				break;
		case 1: currentWidget = sundayWidget;
				break;
		case 2: currentWidget = mondayWidget;
				break;
		case 3: currentWidget = tuesdayWidget;
				break;
		case 4: currentWidget = wednesdayWidget;
				break;
		case 5: currentWidget = thursdayWidget;
				break;
	}
}
//
void DaysForm::on_addButton_clicked()
{
	currentWidget->addRow();
}
//
void DaysForm::on_removeButton_clicked()
{
	currentWidget->delRow();
}

void DaysForm::refresh()
{
	saturdayWidget->refresh();
	sundayWidget->refresh();
	mondayWidget->refresh();
	tuesdayWidget->refresh();
	wednesdayWidget->refresh();
	thursdayWidget->refresh();
}
